/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import java.awt.Component;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.*;

/**
 *
 * @author Superzundi
 */
public class About extends JDialog {

    public About(JFrame MainWin) {
        super(MainWin, "Über HC-Connect", true);
        setLocationRelativeTo(null);
        setDefaultCloseOperation(HIDE_ON_CLOSE);

        JPanel p1 = new JPanel();
        p1.setLayout(new BoxLayout(p1, BoxLayout.Y_AXIS));

        JLabel l1 = new JLabel(" HC-Connect für HC-Media");
        l1.setAlignmentX(Component.CENTER_ALIGNMENT);
        p1.add(l1);
        JLabel l2 = new JLabel(" ein \"Database Administration Utility\"");
        l2.setAlignmentX(JLabel.CENTER_ALIGNMENT);
        p1.add(l2);
        JLabel l3 = new JLabel(" by Daniel Klaassen");
        l3.setAlignmentX(JLabel.CENTER_ALIGNMENT);
        p1.add(l3);
        JLabel l4 = new JLabel(" Diplomprojekt 2010/11");
        l4.setAlignmentX(JLabel.CENTER_ALIGNMENT);
        p1.add(l4);
        
        //HC-Media Link :-D
        final String URL = "http://hc-media.org";
        JLabel l5 = new JLabel("<html><body><a href=" + URL + ">" + URL
                + "</a></body></html>");
        l5.setCursor(new Cursor(Cursor.HAND_CURSOR));
        l5.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (Desktop.isDesktopSupported()) {
                    try {
                        Desktop.getDesktop().browse(new URI(URL));
                    } catch (IOException e1) {
                        System.out.println(e1.getMessage());
                    } catch (URISyntaxException e1) {
                        System.out.println(e1.getMessage());
                    }
                }
            }
        });
        l5.setAlignmentX(JLabel.CENTER_ALIGNMENT);
        p1.add(l5);

        add(p1);
        setSize(300, 140);
        this.pack();
    }
}
